import cv2
import numpy as np
from matplotlib import pyplot as plt

img = cv2.imread(r"/\images\005.jpeg")

# plt.hist(img.ravel(), 256)
# plt.show()

# histb = cv2.calcHist([img], [0], None, [256], [0, 255])
# histg = cv2.calcHist([img], [1], None, [256], [0, 255])
# histr = cv2.calcHist([img], [2], None, [256], [0, 255])

histb, e1 = np.histogram(img.ravel(), 256, [0, 256])
histg, e2 = np.histogram(img.ravel(), 256, [0, 256])
histr, e3 = np.histogram(img.ravel(), 256, [0, 256])

plt.plot(histb, color='b')
plt.plot(histg, color='g')
plt.plot(histr, color='r')

plt.show()
